<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title>Table</title>
<link rel="stylesheet" href="../../plugins/layui/css/layui.css" media="all" />
<link rel="stylesheet" href="../../css/global.css" media="all">
<link rel="stylesheet" href="../../plugins/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="../../css/table.css" />
</head>

<body>
<div class="admin-main">
    <!--<div class="panel-body">-->
        <!--<div class="layui-form">-->
            <!--<div class="layui-form-item">-->
                <!--<label class="layui-form-label">客户订单号</label>-->
                <!--<div class="layui-input-inline">-->
                    <!--<input type="text" name="customerOrderCode" id="customerOrderCode" placeholder="请输入客户订单单号" autocomplete="off" class="layui-input">-->
                <!--</div>-->
                <!--<label class="layui-form-label">中联订单号</label>-->
                <!--<div class="layui-input-inline">-->
                    <!--<input type="text" name="orderCode" id="orderCode" placeholder="请输入订单单号" autocomplete="off" class="layui-input">-->
                <!--</div>-->
                <!--<label class="layui-form-label">提车时间</label>-->
                <!--<div class="layui-input-inline">-->
                    <!--<input class="layui-input" placeholder="开始日" id="pickBeginDate">-->
                <!--</div>-->
                <!--<div class="layui-input-inline">-->
                    <!--<input class="layui-input" placeholder="截止日" id="pickEndDate">-->
                <!--</div>-->
            <!--</div>-->
            <!--<div class="layui-form-item">-->
                <!--<label class="layui-form-label">运输方式</label>-->
                <!--<div class="layui-input-inline">-->
                    <!--<select name="transportType" id="transportType">-->
                        <!--<option value="">请选择运输方式</option>-->
                        <!--<option value="人送">人送</option>-->
                        <!--<option value="零公里">零公里</option>-->
                        <!--<option value="铁运">铁运</option>-->
                        <!--<option value="水运">水运</option>-->
                    <!--</select>-->
                <!--</div>-->
                <!--<label class="layui-form-label">订单状态</label>-->
                <!--<div class="layui-input-inline">-->
                    <!--<select name="orderStatus" id="orderStatus">-->
                        <!--<option value="">请选择运单状态</option>-->
                        <!--<option value="未离昌">未离昌</option>-->
                        <!--<option value="在途">在途</option>-->
                        <!--<option value="交付">交付</option>-->
                    <!--</select>-->
                <!--</div>-->
                <!--<label class="layui-form-label">底盘号</label>-->
                <!--<div class="layui-input-inline">-->
                    <!--<input type="text" name="vehicleVin"  id="vehicleVin" placeholder="请输入底盘号" autocomplete="off" class="layui-input">-->
                <!--</div>-->
                <!--<div class="layui-input-inline" style="width: 240px;">-->
                    <!--<button class="layui-btn"  id="search">查询</button>-->
                    <!--<button type="reset" class="layui-btn layui-btn-primary" id="searchReset">重置</button>-->
                    <!--<button type="reset" class="layui-btn layui-btn-primary" id="exportExecl">导出</button>-->
                <!--</div>-->
            <!--</div>-->
        <!--</div>-->
    <!--</div>-->
</div>
<div class="admin-main" style="overflow: hidden; margin: 0;">
    <div style="overflow: auto; margin-bottom: 50px;">
        <table class="layui-table admin-table" style="width: 2500px;">
            <thead>
                <tr>
                    <th style="width: 3%">序号</th>
                    <th style="width: 5%">货主</th>
                    <th style="width: 5%">调度单号</th>
                    <th style="width: 6%">单据号</th>
                    <th style="width: 5%">单据类型</th>
                    <th style="width: 6%">状态</th>
                    <th style="width: 9%">提货地址</th>
                    <th style="width: 4%">入库仓库</th>
                    <th style="width: 4%">车型</th>
                    <th style="width: 4%">车型描述</th>
                    <th style="width: 5%">数量</th>
                </tr>
            </thead>
            <tbody id="content">
            </tbody>
        </table>
    </div>
    <div class="admin-table-page">
        <div id="paged" class="page">
        </div>
    </div>
</div>
<!--模板-->
<script type="text/html" id="tpl">

    {{# layui.each(d.data, function(index, item){ }}
    <tr>
        <td>{{ index+1 }}</td>
        <td>{{ item.customerOrderCode }}</td>
        <td>{{ item.orderCode }}</td>
        <td>{{ item.vehicleVin }}</td>
        <td>{{ item.vehicleCode }}</td>
        <td>{{ item.vehicleName }}</td>
        <td>{{ item.agentName }}</td>
        <td>{{ item.receiptProvince }}</td>
        <td>{{ item.receiptCity }}</td>
        <td>{{ item.miles }}</td>
        <td>{{ item.pickTime }}</td>
    </tr>
    {{# }); }}

</script>
<script type="text/javascript" src="../../plugins/layui/layui.js"></script>
<script>
    layui.config({
        base: '../../js/'
    });
    layui.use(['paging','form','baajax','laydate'], function() {
        var $ = layui.jquery,
            paging = layui.paging(),
            layerTips = parent.layer === undefined ? layui.layer : parent.layer, //获取父窗口的layer对象
            layer = layui.layer, //获取当前窗口的layer对象
            form = layui.form(),
            laydate = layui.laydate;
        baajax=layui.baajax;
        layer.closeAll();
        var userName = window.parent.document.getElementById("userName").innerHTML;
        var customer_name = '';
        if (userName == 'jmc-fms') {
            customer_name = '五十铃';
        } else if (userName == 'jmc-kms') {
            customer_name = '控股';
        }
        paging.init({
            openWait: true,
            url: 'customer_order_list?v=' + new Date().getTime(), //地址
            elem: '#content', //内容容器
            params: { //发送到服务端的参数
                customerName: customer_name
            },
            type: 'POST',
            tempElem: '#tpl', //模块容器
            pageConfig: { //分页参数配置
                elem: '#paged', //分页容器
                pageSize: 10 //分页大小
            },
            success: function() { //渲染成功的回调
                //alert('渲染成功');
            },
            fail: function(msg) { //获取数据失败的回调
                layer.msg(msg);
                //alert('获取数据失败')
            }
        });

        var start = {
            max: '2099-06-16 23:59:59'
            ,istoday: false
            ,choose: function(datas){
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };

        var end = {
            max: '2099-06-16 23:59:59'
            ,istoday: false
            ,choose: function(datas){
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };

        document.getElementById('pickBeginDate').onclick = function(){
            start.elem = this;
            laydate(start);
        };
        document.getElementById('pickEndDate').onclick = function(){
            end.elem = this
            laydate(end);
        };


        //查询
        $('#search').on('click', function() {
            var customerOrderCode = $('#customerOrderCode').val();
            var orderCode = $('#orderCode').val();
            var vehicleVin = $('#vehicleVin').val();
            var pickBeginDate = $('#pickBeginDate').val();
            var pickEndDate = $('#pickEndDate').val();
            var transportType = $('#transportType').val();
            var orderStatus = $('#orderStatus').val();
            //调用get方法获取数据
            paging.get({
                customerOrderCode: customerOrderCode,//获取输入的关键字。
                vehicleVin: vehicleVin,//获取输入的关键字。
                pickBeginDate: pickBeginDate,//获取输入的关键字。
                pickEndDate: pickEndDate, //获取输入的关键字。
                orderCode: orderCode, //获取输入的关键字。
                transportType: transportType, //获取输入的关键字。
                orderStatus: orderStatus, //获取输入的关键字。
                customerName: customer_name
            });
        });
        $('#exportExecl').click(function () {
            var customerOrderCode = $('#customerOrderCode').val();
            var vehicleVin = $('#vehicleVin').val();
            var pickBeginDate = $('#pickBeginDate').val();
            var pickEndDate = $('#pickEndDate').val();
            var orderCode = $('#orderCode').val();
            var transportType = $('#transportType').val();
            var orderStatus = $('#orderStatus').val();
            window.open("exportExecl?customerOrderCode="
                + customerOrderCode + "&vehicleVin="
                + vehicleVin + "&pickBeginDate="
                + pickBeginDate + "&pickEndDate="
                + pickEndDate + "&orderCode="
                + orderCode + "&transportType="
                + transportType + "&orderStatus="
                + orderStatus + "&customerName="
                + customer_name);
        })
        //查询
        $('#searchReset').on('click', function() {
            var customerOrderCode = $('#customerOrderCode').val('');
            var vehicleVin = $('#vehicleVin').val('');
            var pickBeginDate = $('#pickBeginDate').val('');
            var pickEndDate = $('#pickEndDate').val('');
            var orderCode = $('#orderCode').val('');
            var transportType = $('#transportType').val('');
            var orderStatus = $('#orderStatus').val('');
            form.render('select');
            //调用get方法获取数据
            paging.get({
                customerOrderCode: '',//获取输入的关键字。
                vehicleVin: '',//获取输入的关键字。
                pickBeginDate:'',
                pickEndDate:'',
                orderCode: '',
                transportType: '',
                orderStatus: '',
                customerName: customer_name
            });
        });

        form.render();
    });

</script>
</body>
</html>